import { axios } from '@/utils/request'
// 服务订单管理接口模块

// 新增后台订单
function addBgServiceOrder (data) {
  return axios({
    url: '/service-sale/serviceOrder/bg/add',
    method: 'post',
    data,
    timeout: 5 * 60 * 60 * 100
  })
}

// 获取订单详情
function getServiceOrderDetail (params) {
  return axios({
    url: '/service-sale/serviceOrder/detail',
    method: 'get',
    params
  })
}

// 导出订单
function exportServiceOrder (params) {
  return axios({
    url: '/service-sale/serviceOrder/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 查询服务列表
function getServiceOrderList (params) {
  return axios({
    url: '/service-sale/serviceOrder/list',
    method: 'get',
    params
  })
}

// 后台下单时上传文件
function uploadBgServiceOrderFile (data, params) {
  return axios({
    url: '/service-sale/serviceOrder/pretreatment',
    method: 'post',
    data,
    params
  })
}
// 后台下单来自文件失败数
function uploadBgServiceOrderFileFail (params) {
  return axios({
    url: '/service-sale/serviceOrder/pretreatment/result/data',
    method: 'get',
    params
  })
}
// 导出失败数
function uploadBgServiceOrderFileFailExport (params) {
  return axios({
    url: '/service-sale/serviceOrder/pretreatment/result/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

export default {
  addBgServiceOrder,
  getServiceOrderDetail,
  exportServiceOrder,
  getServiceOrderList,
  uploadBgServiceOrderFile,
  uploadBgServiceOrderFileFail,
  uploadBgServiceOrderFileFailExport
}
